<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>业务表管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			layui.use(['laypage', 'form', 'table'], function(){
				var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功
				form.render();
				var laypage = layui.laypage;
				laypage.render({elem:'pageDiv',
					count: ${page.count}, //数据总数，从服务端得到
					curr:${page.pageNo},
					limit:30,
					layout: ['prev', 'page', 'next', 'count'],
					jump: function(obj, first){
					//obj包含了当前分页的所有参数，比如：
					 // console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
					 // console.log(obj.limit); //得到每页显示的条数
					
					//首次不执行
						if(!first){
							$("#firstPage").val(false);
							page(obj.curr,obj.limit);
						}
					}
				});
				var table = layui.table;
				table.init('genTable',{limit:30});
			});
		});
		function page(n,s){
			if(n) $("#pageNo").val(n);
			if(s) $("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
		<ul class="layui-tab-title">
		<li class="layui-this"><a href="${ctx}/gen/genTable/">业务表列表</a></li>
		<shiro:hasPermission name="gen:genTable:edit"><li><a href="${ctx}/gen/genTable/form">业务表添加</a></li></shiro:hasPermission>
	</ul></div>
	<form:form id="searchForm" modelAttribute="genTable" action="${ctx}/gen/genTable/" method="post" class="layui-form">
		<blockquote class="layui-elem-quote quoteBox">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<sys:tableSort id="orderBy" name="orderBy" value="${page.orderBy}" callback="page();"/>
		<div class="layui-inline">
			<label class="layui-form-label">表名：</label>
			<div class="layui-input-block">
				<form:input path="nameLike" htmlEscape="false" maxlength="50" class="layui-input"/>
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">说明：</label>
			<div class="layui-input-block">
				<form:input path="comments" htmlEscape="false" maxlength="50" class="layui-input"/>
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">父表表名：</label>
			<div class="layui-input-block">
				<form:input path="parentTable" htmlEscape="false" maxlength="50" class="layui-input"/>
			</div>
		</div>
		<div class="layui-inline">
		&nbsp;<input id="btnSubmit" class="layui-btn search_btn" type="submit" value="查询"/>
		</div>
		</blockquote>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="layui-table" lay-filter="genTable">
		<thead><tr>
			<th lay-data="{field:'tableName', minWidth:150}" class="sort-column name">表名</th>
			<th lay-data="{field:'exp', minWidth:150}">说明</th>
			<th lay-data="{field:'className', minWidth:100}" class="sort-column class_name">类名</th>
			<th lay-data="{field:'father', minWidth:150}" class="sort-column parent_table">父表</th>
			<shiro:hasPermission name="gen:genTable:edit">
			<th lay-data="{field:'flag', minWidth:110, fixed:'right'}">操作</th>
			</shiro:hasPermission>
		</tr></thead>
		<tbody>
		<c:forEach items="${page.list}" var="genTable">
			<tr>
				<td><a class="layui-blue" href="${ctx}/gen/genTable/form?id=${genTable.id}">${genTable.name}</a></td>
				<td>${genTable.comments}</td>
				<td>${genTable.className}</td>
				<td title="点击查询子表"><a class="layui-blue" href="javascript:" onclick="$('#parentTable').val('${genTable.parentTable}');$('#searchForm').submit();">${genTable.parentTable}</a></td>
				<shiro:hasPermission name="gen:genTable:edit"><td>
    				<a class="layui-btn layui-btn-xs" lay-event="edit" href="${ctx}/gen/genTable/form?id=${genTable.id}">修改</a>
					<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" href="${ctx}/gen/genTable/delete?id=${genTable.id}" onclick="return confirmx('确认要删除该业务表吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div id="pageDiv" class="pagination layui-elem-field layui-field-title">${page}</div>
</body>
</html>
